<template>
  <div v-if="params.data.id <= 0">
    新增
  </div>
  <div v-else>
    <el-link type="primary" @click="onLinkClick">{{ params.value }}</el-link>
  </div>
</template>

<script lang="ts" setup>
import { ICellRendererParams } from 'ag-grid-community';
import { useRouter } from 'vue-router';

const $router = useRouter();

const props = defineProps<{
  params: ICellRendererParams;
}>();

function onLinkClick() {
  $router.push(`/view/${props.params.value}`);
}
</script>
